package bio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer2 {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(9002);

        while (true){
            Socket accept = serverSocket.accept();
            System.out.println("有客户端连接");
            handler(accept);
            new Thread(new Runnable() {
                @Override
                public void run() {

                }
            }).start();
        }
    }

    public static void handler(Socket socket) throws IOException {
        byte[] bytes = new byte[1024];
        socket.getInputStream().read(bytes);
    }

}
